/**
 ******************************************************************************
 * @FilePath: \Hero\Module\Chassis.h
 * @Brief: 
 * @Date: 2021-01-11 23:59:20
 * @Author: Rio
 ******************************************************************************
 */
#ifndef __CHASSIS_H__
#define __CHASSIS_H__

#include "main.h"
/*********************** 底盘信息结构体 *************************/
typedef struct
{
	//传入参数
	float gyro_speed;/*the gyro angle speed set in chassis*/
	float gyro_angle;/*the gyro angle set in chassis*/
	float angle_diff;/*the angle difference to gimbal(chassis-gimbal)*/

	/*底盘运动相关参数*/
	int16_t Vx;/*the speed from chassis view (forward--positive)*/
	int16_t Vy;/*the speed from chassis view (right--positive)*/
	int16_t Wz;/*the speed from chassis view (CCW--positive)*/

	float chassis_power,chassis_power_limit;
	uint16_t chassis_power_buffer;
	double chassis_volt;
	double chassis_current;
	uint16_t cur_sum;
	uint16_t cur_sum_limit;

	float capVol;
	float capInV;
	float capInC;
	float cap_expect;

}chassisMove_t;

#define KEY_PRESSED_OFFSET_W            ((uint16_t)1 << 0)
#define KEY_PRESSED_OFFSET_S            ((uint16_t)1 << 1)
#define KEY_PRESSED_OFFSET_A            ((uint16_t)1 << 2)
#define KEY_PRESSED_OFFSET_D            ((uint16_t)1 << 3)
#define KEY_PRESSED_OFFSET_SHIFT        ((uint16_t)1 << 4)
#define KEY_PRESSED_OFFSET_CTRL         ((uint16_t)1 << 5)
#define KEY_PRESSED_OFFSET_Q            ((uint16_t)1 << 6)
#define KEY_PRESSED_OFFSET_E            ((uint16_t)1 << 7)
#define KEY_PRESSED_OFFSET_R            ((uint16_t)1 << 8)
#define KEY_PRESSED_OFFSET_F            ((uint16_t)1 << 9)
#define KEY_PRESSED_OFFSET_G            ((uint16_t)1 << 10)
#define KEY_PRESSED_OFFSET_Z            ((uint16_t)1 << 11)
#define KEY_PRESSED_OFFSET_X            ((uint16_t)1 << 12)
#define KEY_PRESSED_OFFSET_C            ((uint16_t)1 << 13)
#define KEY_PRESSED_OFFSET_V            ((uint16_t)1 << 14)
#define KEY_PRESSED_OFFSET_B            ((uint16_t)1 << 15)

#define CHASSIS_FRONT_KEY KEY_PRESSED_OFFSET_W
#define CHASSIS_BACK_KEY KEY_PRESSED_OFFSET_S
#define CHASSIS_LEFT_KEY KEY_PRESSED_OFFSET_A
#define CHASSIS_RIGHT_KEY KEY_PRESSED_OFFSET_D

void Chassis_Move(void);
void ChassisMotor_Init(void);

#endif

